|
Eclipse Platform Pre-release 3.0 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.jface.action.ContributionItem
org.eclipse.ui.commands.CommandContributionItem
A contribution item which delegates to a command. This is a contribution item that just passes as much of the complexity as it can on to the underlying command.
This class may be instantiated; it is not intended to be subclassed.
Constructor Summary | |
CommandContributionItem(ICommand commandToUse)
Creates a new contribution item from the given command. |
Method Summary | |
void |
commandChanged(CommandEvent e)
Handles a change event on the command. |
boolean |
equals(Object o)
Compares this command contribution item with another object. |
void |
fill(Composite parent)
The CommandContributionItem implementation of this IContributionItem
method creates an SWT Button for the command using the
command's style. |
void |
fill(Menu parent,
int index)
The CommandContributionItem implementation of this IContributionItem
method creates an SWT MenuItem for the action using the
command's style. |
void |
fill(ToolBar parent,
int index)
The CommandContributionItem implementation of this IContributionItem
method creates an SWT ToolItem for the command using the
command's style. |
ICommand |
getCommand()
Returns the command associated with this contribution item. |
static boolean |
getUseColourIconsInToolbars()
Returns whether color icons should be used in toolbars. |
int |
hashCode()
|
boolean |
isDynamic()
The command item implementation of this IContributionItem
method returns true for menu items and false
for everything else. |
boolean |
isEnabled()
The default implementation of this IContributionItem
method returns true . |
protected boolean |
isEnabledAllowed()
Returns true if this item is allowed to enable, false
otherwise. |
boolean |
isVisible()
Whether this contribution item should be visible. |
static String |
removeAcceleratorText(String text)
Convenience method for removing any optional accelerator text from the given string. |
static void |
setUseColourIconsInToolbars(boolean newValue)
Sets whether color icons should be used in toolbars. |
void |
update()
The command item implementation of this IContributionItem
method calls update(null) . |
void |
update(CommandEvent event)
Synchronizes the UI with the given property. |
Methods inherited from class org.eclipse.jface.action.ContributionItem |
dispose, fill, getId, getParent, isDirty, isGroupMarker, isSeparator, saveWidgetState, setParent, setVisible, toString, update |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public CommandContributionItem(ICommand commandToUse)
Method Detail |
public static boolean getUseColourIconsInToolbars()
true
if color icons should be used in toolbars;
false
otherwise.public static String removeAcceleratorText(String text)
'\t'
.
text
- The text to be stripped; must not be null
.
null
.public static void setUseColourIconsInToolbars(boolean newValue)
newValue
- true
if color icons should be used in
toolbars, false
otherwisepublic void commandChanged(CommandEvent e)
commandChanged
in interface ICommandListener
e
- The triggering event; must not be null
.public boolean equals(Object o)
o
- The object with which to compare; may be null
.public void fill(Composite parent)
CommandContributionItem
implementation of this IContributionItem
method creates an SWT Button
for the command using the
command's style. If the command's checked property has been set, the
button is created and primed to the value of the checked property.
fill
in interface IContributionItem
fill
in class ContributionItem
parent
- The composite parent which this contribution should place
itself on; must not be null
.public void fill(Menu parent, int index)
CommandContributionItem
implementation of this IContributionItem
method creates an SWT MenuItem
for the action using the
command's style. If the command's checked property has been set, a
button is created and primed to the value of the checked property. If
the command's menu creator property has been set, a cascading submenu is
created.
fill
in interface IContributionItem
fill
in class ContributionItem
parent
- The menu on which this contribution item should place itself;
must not be null
.index
- The index at which this contribution item should place
itself. If it is a negative number, then this simply appends
the item.public void fill(ToolBar parent, int index)
CommandContributionItem
implementation of this IContributionItem
method creates an SWT ToolItem
for the command using the
command's style. If the command's checked property has been set, a
button is created and primed to the value of the checked property. If
the command's menu creator property has been set, a drop-down tool item
is created.
fill
in interface IContributionItem
fill
in class ContributionItem
parent
- The tool bar on which this contribution item should place
itself; must not be null
.index
- The index at which this contribution item should place
itself. If it is a negative number, then this simply appends
the item.public ICommand getCommand()
null
.public int hashCode()
public boolean isDynamic()
IContributionItem
method returns true
for menu items and false
for everything else.
isDynamic
in interface IContributionItem
isDynamic
in class ContributionItem
public boolean isEnabled()
ContributionItem
IContributionItem
method returns true
. Subclasses may override.
isEnabled
in interface IContributionItem
isEnabled
in class ContributionItem
protected boolean isEnabledAllowed()
true
if this item is allowed to enable, false
otherwise.
public boolean isVisible()
isVisible
in interface IContributionItem
isVisible
in class ContributionItem
true
if the command is active; false
otherwise.public void update()
IContributionItem
method calls update(null)
.
update
in interface IContributionItem
update
in class ContributionItem
public void update(CommandEvent event)
event
- The event triggering the update (which specifies how much of
the command changed). If null
, then
everything is updated.
|
Eclipse Platform Pre-release 3.0 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |